HTMLify
style.css
Views: 4 | Author: cody
@import "https://fonts.googleapis.com/css2?family=Poppins:wght@200;300;400;500;600;700&display=swap";
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
height: 100vh;
background-color: #151515;
display: grid;
place-items: center;
}
.button-container {
position: relative;
height: 80px;
width: 200px;
border: 1px solid #fff;
border-radius: 0.5rem;
overflow: hidden;
display: flex;
justify-content: center;
align-items: center;
}
.button-container button {
width: 100%;
height: 100%;
font-family: "poppins";
font-weight: 700;
font-size: 1.25rem;
mask: url(https://raw.githubusercontent.com/robin-dela/css-mask-animation/master/img/nature-sprite.png);
mask-size: 2300% 100%;
-webkit-mask: url(https://raw.githubusercontent.com/robin-dela/css-mask-animation/master/img/nature-sprite.png);
-webkit-mask-size: 2300% 100%;
border: none;
cursor: pointer;
animation: anim2 0.7s steps(22) forwards;
}
.button-container button:hover {
animation: anim1 0.7s steps(22) forwards;
color: #000;
}
.mask {
position: absolute;
color: #fff;
display: grid;
place-items: center;
font-family: "poppins";
font-weight: 700;
font-size: 2rem;
width: 100%;
}
@keyframes anim1 {
from {
-webkit-mask-position: 100% 0;
mask-position: 100% 0;
}
to {
-webkit-mask-position: 0 0;
mask-position: 0 0;
}
}
@keyframes anim2 {
from {
-webkit-mask-position: 0 0;
mask-position: 0 0;
}
to {
-webkit-mask-position: 100% 0;
mask-position: 100% 0;
}
}